# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-rss
_gemname=rss
pkgver=0.2.9
pkgrel=1
pkgdesc="RSS reading and writing for Ruby"
url="https://github.com/ruby/rss"
arch="noarch"
license="BSD-2-Clause"
depends="ruby ruby-rexml"
checkdepends="ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/ruby/rss/archive/$pkgver/$pkgname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare
	sed -i '/require .bundler/d' Rakefile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	ruby test/run-test.rb
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--document ri \
		--verbose \
		$_gemname

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')"/doc
}

sha512sums="
dcb87c26bbc52a90b75f9ac97f7a59ddf821bba8f1843de2dc1ae9b9dffbaf51993a2c99e9ee02b08513a8ce94934afd867ba328dfda9244a73f2b147932af3d  ruby-rss-0.2.9.tar.gz
d5ba5d7cea9b2a19624f3acead6731176770dc94b24a1da28dcd5795172ee56145af1f513076fb96b6cf3d45d0587adf6632a6298bc1a3fe624f7f3ca5005f70  gemspec.patch
"
